package com.wq.jdk8;

import java.lang.reflect.Field;

/**
 * @Author: wangqiang20995
 * @Date:2019/2/26
 * @Description:
 * @Resource:
 */
public class StaticDemo {

    private static Container container = new Container();

    private static final Container finalContainer = new Container();

    private String info = ":";

    public void instance(){
        StaticDemo.container = new Container();
    }

    public void mapAddress(){
        System.out.println(container+"|" + finalContainer);
    }


    public static void main(String args[]) throws NoSuchFieldException, IllegalAccessException, ClassNotFoundException {
        StaticDemo demo = new StaticDemo();

        demo.mapAddress();

        Class<StaticDemo> clazz = StaticDemo.class;

        System.out.println(StaticDemo.class.getClassLoader());

        Field field = clazz.getDeclaredField("container");

        field.setAccessible(true);

        field.set(demo,new Container());

        Field finalField = clazz.getDeclaredField("finalContainer");

        finalField.setAccessible(true);

        finalField.set(demo,new Container());

        demo.mapAddress();

    }
}

class Container{}
